package 调度顺序;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: lenovo
 * Date: 2022-10-06
 * Time: 15:14
 */
public class demo1 {
    public static void main(String[] args) {
        Object object = new Object();
        Thread t = new Thread(){
            @Override
            public void run() {
                synchronized (object){
                    System.out.println("wait前的业务逻辑");
                    try {
                        object.wait();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    System.out.println("wait后的逻辑");
                }

            }
        };
        Thread t1 = new Thread(){
            @Override
            public void run() {
                synchronized (object){
                    System.out.println("notify之前的逻辑");
                    object.notify();
                    System.out.println("notify之后的逻辑");
                }

            }
        };
        t.start();
        t1.start();
    }
}
